import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { HttpClient, HttpParams } from "@angular/common/http";
import {Base} from '../../common/base.js';

/**
 * Generated class for the StatisDetailPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@Component({
  selector: 'page-statis-detail',
  templateUrl: 'statis-detail.html',
})
export class StatisDetailPage {

  constructor(public navCtrl: NavController, public navParams: NavParams,
    private httpClient: HttpClient,private base:Base) {
  }
  DisplayArr = [];
  module = "";
  ionViewDidLoad() {
    if(this.navParams.get("module")=="诱捕器管理"){
      this.module = "trap";
    }else if(this.navParams.get("module")=="注干剂管理"){
      this.module = "dry";
    }else if(this.navParams.get("module")=="天敌防治管理"){
      this.module = "ene";
    }else if(this.navParams.get("module")=="枯死树管理"){
      this.module = "dead";
    }else if(this.navParams.get("module")=="药剂防治管理"){
      this.module = "med";
    }else{
      this.module = "track";
    }
    console.log(this.module);
    
    console.log('ionViewDidLoad StatisDetailPage');
    this.httpClient.post(this.base.BASE_URL + "app/NumDetail",{},{
      headers: { token: localStorage['token']},
      params:{
        module: this.module
      }
    }).subscribe((res:any)=>{
      // alert(JSON.stringify(res));
      this.DisplayArr = Array.from(res);
      console.log(res);
    },msg=>{
      console.log(msg);
    })
  }

}
